package work.jame.blog.controller;


import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import work.jame.blog.framework.limit.RequestLimit;
import work.jame.blog.framework.result.Result;
import work.jame.blog.service.UserArticleRiceGrainsService;

import java.util.concurrent.TimeUnit;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author Jame
 * @since 2023-05-18
 */
@RestController
@RequestMapping("/userArticleRiceGrains")
public class UserArticleRiceGrainsController {

    @Autowired
    private UserArticleRiceGrainsService userArticleRiceGrainsService;

    @ApiOperation("投喂文章作者")
    @GetMapping("/feedArticlePublisher")
    @RequestLimit(value = 10, timeUnit = TimeUnit.MINUTES)
    public Result<?> feedArticlePublisher(@RequestParam("articleId") Long articleId,
                                          @RequestParam("riceGrainsNumber") Double riceGrainsNumber) {
        userArticleRiceGrainsService.feedArticlePublisher(articleId, riceGrainsNumber);
        return Result.succeedMessage("投喂成功!");
    }


}
